home *** CD-ROM | disk | FTP | other *** search
- Option Explicit
- '***************************************************************
- '* XAMPP PortCheck v1.2 *
- '* *
- '* (c) 2005 Carsten Wiedmann <info@wiedmann-online.de> *
- '***************************************************************
- '**Start Encode**
- Dim WshShell, WshSysEnv, objExec
- Dim strOpenPorts, strListenPorts, strAusgabe, strOS, strTemp
- Dim arrOpenPorts, arrListenPorts(), arrSplitListenPorts(), arrXAMPPPorts(), arrTempA, arrTempB()
- Dim intZaehlerA, intZaehlerB, intPort
-
- Set WshShell = CreateObject("WScript.Shell")
-
- If 0 = Instr(LCase(WScript.FullName), "cscript.exe") Then
- WshShell.Run "CScript.exe //Nologo " & WScript.ScriptName
- Set WshShell = Nothing
- WScript.Quit()
- End If
-
- Set WshSysEnv = WshShell.Environment("Process")
- strOS = WshSysEnv("OS")
- Set WshSysEnv = Nothing
-
- WshShell.AppActivate "cscript.exe"
- strAusgabe = vbNewLine & "***************************************************************" & vbNewLine
- strAusgabe = strAusgabe & "* XAMPP PortCheck v1.2 *" & vbNewLine
- strAusgabe = strAusgabe & "* *" & vbNewLine
- strAusgabe = strAusgabe & "* (c) 2005 Carsten Wiedmann <info@wiedmann-online.de> *" & vbNewLine
- strAusgabe = strAusgabe & "* *" & vbNewLine
- strAusgabe = strAusgabe & "* This script uses openport.exe: *" & vbNewLine
- strAusgabe = strAusgabe & "* (c) 2003 DiamondCS <http://www.diamondcs.com.au/openports/> *" & vbNewLine
- strAusgabe = strAusgabe & "***************************************************************" & vbNewLine & vbNewLine
- strAusgabe = strAusgabe & "Please wait a moment..."
- Wscript.Echo strAusgabe
-
- If LCase(strOS) = "windows_nt" Then
- strOpenPorts = ""
- Set objExec = WshShell.Exec("openports.exe -csv -path")
- If Not objExec.StdOut.AtEndOfStream Then
- strOpenPorts = objExec.StdOut.ReadAll
- End If
- arrOpenPorts = Split(strOpenPorts, vbNewLine)
-
- Set objExec = Nothing
- Set WshShell = Nothing
-
- intZaehlerA = 0
- ReDim arrListenPorts(intZaehlerA)
- For Each strListenPorts In arrOpenPorts
- If 0 < Instr(strListenPorts, "LISTENING") Then
- ReDim Preserve arrListenPorts(intZaehlerA)
- arrListenPorts(intZaehlerA) = strListenPorts
- intZaehlerA = intZaehlerA + 1
- End If
- Next
- Erase arrOpenPorts
-
- intZaehlerA = 0
- ReDim arrSplitListenPorts(7, intZaehlerA)
- For Each strListenPorts In arrListenPorts
- ReDim Preserve arrSplitListenPorts(7, intZaehlerA)
- arrTempA = Split(strListenPorts, ",")
-
- For intZaehlerB = 0 To 7
- arrSplitListenPorts(intZaehlerB, intZaehlerA) = arrTempA(intZaehlerB)
- Next
-
- intZaehlerA = intZaehlerA + 1
- Next
- Erase arrTempA
- Erase arrListenPorts
- Else
- strOpenPorts = ""
- Set objExec = WshShell.Exec("netstat -a -n")
- If Not objExec.StdOut.AtEndOfStream Then
- strOpenPorts = objExec.StdOut.ReadAll
- End If
- arrOpenPorts = Split(strOpenPorts, vbNewLine)
-
- Set objExec = Nothing
- Set WshShell = Nothing
-
- intZaehlerA = 0
- ReDim arrListenPorts(intZaehlerA)
- For Each strListenPorts In arrOpenPorts
- If 0 < Instr(strListenPorts, " TCP ") Or 0 < Instr(strListenPorts, " UDP ") Then
- ReDim Preserve arrListenPorts(intZaehlerA)
- arrListenPorts(intZaehlerA) = strListenPorts
- intZaehlerA = intZaehlerA + 1
- End If
- Next
- Erase arrOpenPorts
-
- intZaehlerA = 0
- ReDim arrSplitListenPorts(7, intZaehlerA)
- For Each strListenPorts In arrListenPorts
- ReDim Preserve arrSplitListenPorts(7, intZaehlerA)
- arrTempA = Split(strListenPorts, " ")
-
- intZaehlerB = 0
- ReDim arrTempB(intZaehlerB)
- For Each strTemp In arrTempA
- If 0 <> Len(strTemp) Then
- ReDim Preserve arrTempB(intZaehlerB)
- arrTempB(intZaehlerB) = strTemp
- intZaehlerB = intZaehlerB + 1
- End If
- Next
- arrSplitListenPorts(2, intZaehlerA) = "in use (endpoint is not available with this OS)"
- arrSplitListenPorts(4, intZaehlerA) = Right(arrTempB(1), Len(arrTempB(1)) - InstrRev(arrTempB(1), ":"))
-
- intZaehlerA = intZaehlerA + 1
- Next
- Erase arrTempA
- Erase arrTempB
- Erase arrListenPorts
- End If
-
- ReDim arrXAMPPPorts(8)
- For intZaehlerA = 0 to 8
- arrXAMPPPorts(intZaehlerA) = "free"
- Next
- For intZaehlerA = 0 To UBound(arrSplitListenPorts, 2)
- intPort = arrSplitListenPorts(4, intZaehlerA)
- Select Case intPort
- Case 80
- arrXAMPPPorts(0) = arrSplitListenPorts(2, intZaehlerA)
- Case 81
- arrXAMPPPorts(1) = arrSplitListenPorts(2, intZaehlerA)
- Case 443
- arrXAMPPPorts(2) = arrSplitListenPorts(2, intZaehlerA)
- Case 3306
- arrXAMPPPorts(3) = arrSplitListenPorts(2, intZaehlerA)
- Case 21
- arrXAMPPPorts(4) = arrSplitListenPorts(2, intZaehlerA)
- Case 14147
- arrXAMPPPorts(5) = arrSplitListenPorts(2, intZaehlerA)
- Case 25
- arrXAMPPPorts(6) = arrSplitListenPorts(2, intZaehlerA)
- Case 110
- arrXAMPPPorts(7) = arrSplitListenPorts(2, intZaehlerA)
- Case 143
- arrXAMPPPorts(8) = arrSplitListenPorts(2, intZaehlerA)
- End Select
- Next
- Erase arrSplitListenPorts
-
- strAusgabe = vbNewLine & vbNewLine & "RESULT" & vbNewLine
- strAusgabe = strAusgabe & "------" & vbNewLine & vbNewLine
- strAusgabe = strAusgabe & "Service Port Status" & vbNewLine
- strAusgabe = strAusgabe & "==============================================================================" & vbNewLine
- strAusgabe = strAusgabe & "Apache (HTTP) 80 " & arrXAMPPPorts(0) & vbNewLine
- strAusgabe = strAusgabe & "Apache (WebDAV) 81 " & arrXAMPPPorts(1) & vbNewLine
- strAusgabe = strAusgabe & "Apache (HTTPS) 443 " & arrXAMPPPorts(2) & vbNewLine & vbNewLine
- strAusgabe = strAusgabe & "MySQL 3306 " & arrXAMPPPorts(3) & vbNewLine & vbNewLine
- strAusgabe = strAusgabe & "FileZilla (FTP) 21 " & arrXAMPPPorts(4) & vbNewLine
- strAusgabe = strAusgabe & "FileZilla (Admin) 14147 " & arrXAMPPPorts(5) & vbNewLine & vbNewLine
- strAusgabe = strAusgabe & "Mercury (SMTP) 25 " & arrXAMPPPorts(6) & vbNewLine
- strAusgabe = strAusgabe & "Mercury (POP3) 110 " & arrXAMPPPorts(7) & vbNewLine
- strAusgabe = strAusgabe & "Mercury (IMAP) 143 " & arrXAMPPPorts(8)
- Wscript.Echo strAusgabe
- Erase arrXAMPPPorts
-
- WScript.Echo vbNewLine & "Press <Return> to continue."
- WScript.StdIn.ReadLine
-
- WScript.Quit()
-